package com.sushi.controller;

import com.sushi.service.ActivityService;
import com.sushi.response.ResponseBO;
import com.sushi.response.ResponsePageBO;
import com.sushi.response.ActivityResp;
import com.sushi.request.ActivityReq;
import com.sushi.request.ActivityPageReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.*;

/**
 * 活动 控制器
 * @date 2023-05-02
 * @time 17:12:13
 * @author Administrator
 */
@RestController
@Slf4j
public class ActivityController {

	@Autowired
	private ActivityService activityService;

    

    /**
     * 新增
     */
    @PostMapping("/activity/add")
    public ResponseBO<ActivityResp> add(@RequestBody ActivityReq req) {
        return activityService.add(req);
    }

    /**
     * 逻辑删除
     */
    @PostMapping("/activity/remove")
    public ResponseBO<ActivityResp> remove(@RequestBody ActivityReq req) {
        return activityService.logicRemove(req);
    }

    /**
     * 更新
     */
    @PostMapping("/activity/update")
    public ResponseBO<ActivityResp> update(@RequestBody ActivityReq req) {
        return activityService.updateByField(req);
    }

    /**
     * 列表
     */
    @PostMapping("/activity/list")
    public ResponsePageBO<ActivityResp> list(@RequestBody ActivityPageReq req) {
        return activityService.listByCondition(req);
    }

    /**
     * 详情
     */
    @PostMapping("/activity/detail")
    public ResponseBO<ActivityResp> detail(@RequestBody ActivityReq req) {
        return activityService.detail(req);
    };

}